package com.jiazhong.异常;

public class Demo04 {
    public static void main(String[] args) {
        try {
            Welcome(12);
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
    public static void Welcome(int age) throws Exception{
        if (age<18){
            throw new Exception("未成年人不得进入");
        }
        System.out.println("欢迎光临");
    }
}
